export const generateId = (): string => {
  return Math.random().toString(36).substr(2, 9)
}

export const validateSchema = (schema: any): boolean => {
  // 简单的schema验证
  return !!(schema && Array.isArray(schema.fields))
}

export const deepClone = <T>(obj: T): T => {
  return JSON.parse(JSON.stringify(obj))
}

export const getFieldComponent = (type: string): string => {
  const componentMap: { [key: string]: string } = {
    input: 'el-input',
    textarea: 'el-input',
    select: 'el-select',
    radio: 'el-radio-group',
    checkbox: 'el-checkbox-group',
    date: 'el-date-picker',
    time: 'el-time-picker'
  }
  return componentMap[type] || 'el-input'
}